package com.future.hedongjun.mine.ui;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.future.baselib.activity.BaseActivity;
import com.future.baselib.entity.BaseResponse;
import com.future.baselib.entity.DefaultResponse;
import com.future.baselib.http.HttpRequest;
import com.future.hedongjun.R;
import com.future.hedongjun.common.MyApp;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ReportActivity extends BaseActivity {

    @BindView(R.id.et_report_content)
    EditText etContent;
    @BindView(R.id.btn_ok)
    Button btnOk;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_report);
        ButterKnife.bind(this);
        setTitle("意见反馈");

    }

    @OnClick(R.id.btn_ok)
    public void onViewClicked() {

        String content = etContent.getText().toString().trim();
        if (TextUtils.isEmpty(content)) {
            toast("意见反馈不能为空");
            return;
        }

        new HttpRequest<DefaultResponse>()
                .with(this)
                .setPath("/api/My/opinion")
                .addParam("token", MyApp.getInstance().getUserInfo().getToken())
                .addParam("content",content)
                .addSuccessListener(new HttpRequest.OnNetworkSuccess() {
                    @Override
                    public void onSuccess(BaseResponse response) {
                        toast("提交成功，感谢您的宝贵意见。");
                        finish();
                    }
                }).start(new DefaultResponse());
    }
}
